angular.module('starter')
  .config(function($stateProvider) {
    $stateProvider.state('addTable9', {
      url: '/addTable9/:tableId',
      templateUrl: 'templates/addTable9/addTable9.html',
      controller: 'addTable9Ctrl',
      controllerAs: 'addTable9Ctrl'
    })
  })
  .controller('addTable9Ctrl', function($scope) {

    this.data = {
      teamName: "无锡路桥",
      checkEmployerName: "监理公司",
      pageNum: "123",
      tableType: 4, // 表格类型
      layerType: "1", // 面层类型1 2 3 
      recordNo: "1234", // 编号
      workTime: "2016-05-05", // 施工日期str
      workTimeDate: null, // 施工日期Date
      writeDate: "", // 填表日期
      defectIshandled: 1, // 下承层缺陷是否处理完毕 
      status: 1, // 状态:0:草稿;1:新增
      postil: "批注批注批注批注批注", // 批注
      workPoint: "1", // 作业点
      layer: "10",
      ranges: 5,
      illustrate: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      checkItemList: [{
        startStakeFirst: 66,
        startStakeLast: 68,
        endStakeFirst: 5,
        endStakeLast: 6,
        middlePaveTemperature: 3, //靠近中分带摊铺温度
        middleFirstpressTemperature: 3, //靠近中分带初压温度
        middleNextpressTemperature:3,//靠近中分带复压温度
        middleEndpressTemperature:3,//靠近中分带终压温度
  
        outboardPaveTemperature: 10, //路肩外侧摊铺温度
        outboardTemperature: 10, //路肩外侧初压温度
        outboardNextpressTemperature:"",//路肩外侧复压温度
        outboardEndpressTemperature: "", //路肩外侧终压温度

        jointPaveTemperature: "", //接缝摊铺温度
        jointFirstpressTemperature: 10, //接缝初压温度
        jointNextpressTemperature: 3, //接缝复压温度
        jointEndpressTemperature: "", //接缝终压温度
      }]
    };

    this.checkItem = function() {
      this.workTime = $scope.dateToStr(this.data.workTimeDate, 'yyyy-MM-dd');
      return true;
    }

    this.saveTable = function() {
      console.log(this.data);
      if (this.checkItem()) {
        $scope.showAlert("新增成功");
      }
    };
  });